﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Calculations
{
	public class CalculationModel : ICalculationModel
	{
		private int _woodRate;
		private int _clayRate;
		private int _ironRate;
		private int _cropRate;
		SnapShot _startingValues;

		#region ICalculationModel Members

		public int WoodRate
		{
			get
			{
				return _woodRate;
			}
			set
			{
				_woodRate = value;
			}
		}

		public int ClayRate
		{
			get
			{
				return _clayRate;
			}
			set
			{
				_clayRate = value;
			}
		}

		public int IronRate
		{
			get
			{
				return _ironRate;
			}
			set
			{
				_ironRate = value;
			}
		}

		public int CropRate
		{
			get
			{
				return _cropRate;
			}
			set
			{
				_cropRate = value;
			}
		}

		public SnapShot StartingValues
		{
			get
			{
				return _startingValues;
			}
			set
			{
				_startingValues = value;
			}
		}

		public IEnumerable<SnapShot> Timeline(int hours)
		{
			int counter = 0;
			SnapShot current = _startingValues;
			while (counter < hours)
			{
				counter++;
				current = current.Increment(this);
				yield return current;
			}
		}

		#endregion
	}
}
